<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="LoanCasesList.aspx.cs"
    MasterPageFile="~/MasterPages/Core.Master" Inherits="Pap.Web.Modules.Loan.Views.LoanCasesList"
    Title="Loan Cases" meta:resourcekey="PageResource2" %>

<asp:Content runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <ext:Store runat="server" ID="storeLoanCases" AutoLoad="True" IDMode="Legacy" meta:resourcekey="storeLoanCasesResource2"
        SerializationMode="Simple">
        <Reader>
            <ext:JsonReader ReaderID="LoanID">
                <Fields>
                    <ext:RecordField Name="LoanID" />
                    <ext:RecordField Name="LoanNumber" />
                    <ext:RecordField Name="CustomerName" />
                    <ext:RecordField Name="LoanDate" />
                    <ext:RecordField Name="CaseNumber" />
                    <ext:RecordField Name="CaseDate" />
                </Fields>
            </ext:JsonReader>
        </Reader>
        <SortInfo Direction="ASC"></SortInfo>
    </ext:Store>


    <ext:FitLayout runat="server">
        <ext:Panel runat="server" AutoScroll="true">
            <Body>
                <ext:GridPanel runat="server" ID="gridLoanCases" StoreID="storeLoanCases" StripeRows="true"
                    AutoHeight="true" Title="<%$Resources:LoanCases %>" AutoExpandColumn="commandCol">
                    <ColumnModel>
                        <Columns>
                            <ext:Column DataIndex="LoanNumber" Header="<%$Resources:HeaderLoanNumber %>" />
                            <ext:Column DataIndex="CustomerName" Header="<%$Resources:HeaderCustomerName %>" />
                            <ext:Column DataIndex="LoanDate" Header="<%$Resources:HeaderLoanDate %>">
                                <Renderer Fn="Ext.util.Format.dateRenderer('d/m/Y')" />
                            </ext:Column>
                            <ext:Column DataIndex="CaseNumber" Header="<%$Resources:HeaderCaseNumber %>" />
                            <ext:Column DataIndex="CaseDate" Header="<%$Resources:HeaderCaseDate %>">
                                <Renderer Fn="Ext.util.Format.dateRenderer('d/m/Y')" />
                            </ext:Column>
                            <ext:CommandColumn ColumnID="commandCol" Header="<%$Resources:HeaderDecision %>">
                                <Commands>
                                    <ext:GridCommand CommandName="PayAll" Icon="Money" Text="<%$Resources:PayAll%>" ToolTip-Text="<%$Resources:TipPayAll%>" />
                                    <ext:GridCommand CommandName="CancelAllDebts" Icon="Cancel" Text="<%$Resources:CancelAllDebts%>"
                                        ToolTip-Text="<%$Resources:TipCancelAllDebts%>" />
                                </Commands>
                            </ext:CommandColumn>
                        </Columns>
                    </ColumnModel>
                    <SelectionModel>
                        <ext:RowSelectionModel runat="server" SingleSelect="true" />
                    </SelectionModel>
                    <AjaxEvents>
                        <Command OnEvent="gridLoanCases_Clicked">
                            <ExtraParams>
                                <ext:Parameter Name="CommandName" Value="command" Mode="Raw" Encode="false" />
                                <ext:Parameter Name="LoanID" Value="record.data.LoanID" Mode="Raw" Encode="false" />
                            </ExtraParams>
                            <EventMask ShowMask="true" />
                        </Command>
                    </AjaxEvents>
                </ext:GridPanel>
            </Body>
        </ext:Panel>
    </ext:FitLayout>
    <ext:Window runat="server" ID="wndPayAll" AutoScroll="true" Modal="true" ShowOnLoad="false"
        Width="340" Height="117">
        <Body>
            <ext:FitLayout runat="server">
                <ext:FormPanel runat="server" ID="wndPanel" IDMode="Static" AutoHeight="true">
                    <Body>
                        <ext:FormLayout runat="server">
                            <ext:Anchor>
                                <ext:TextField runat="server" ID="txtAllDebts" Disabled="true" FieldLabel="AllDebts" />
                            </ext:Anchor>
                            <ext:Anchor>
                                <ext:NumberField runat="server" ID="txtNumPaymentAmount" FieldLabel="PaymentAmount"
                                    AllowNegative="true" MinValue="1" AllowBlank="false" />
                            </ext:Anchor>
                        </ext:FormLayout>
                    </Body>
                    <BottomBar>
                        <ext:StatusBar runat="server">
                            <Items>
                                <ext:Button runat="server" ID="btnPayDebts" Text="PayDebts" Icon="Money">
                                    <AjaxEvents>
                                        <Click OnEvent="BtnPayDebts_Clicked" Before="return Ext.getCmp('wndPanel').getForm().isValid();">
                                            <Confirmation ConfirmRequest="true" Message="r u sure" Title="confrm" BeforeConfirm="return Ext.getCmp('wndPanel').getForm().isValid();" />
                                        </Click>
                                    </AjaxEvents>
                                </ext:Button>
                            </Items>
                        </ext:StatusBar>
                    </BottomBar>
                </ext:FormPanel>
            </ext:FitLayout>
        </Body>
    </ext:Window>
</asp:Content>
